package com.example.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springboot.controller.dto.UserPasswordDto;
import com.example.springboot.entity.User;
import org.apache.ibatis.annotations.*;

import javax.swing.*;
import java.util.List;

//与数据库进行交互的接口
/*@Mapper*/
public interface UserMapper extends BaseMapper<User>{
    @Update("update sys_user set password = #{newPassword} where username =#{username} and password = #{password}")
    int updatePassword(UserPasswordDto userPasswordDto);
/*
    @Select("SELECT * FROM `sys_user`")
    List<User> findAll();

    @Insert("INSERT INTO sys_user(username,password,phone,address,emil)VALUES" +
            "(#{username},#{password},#{phone},#{address},#{emil});")
    int insert(User user);

    int update(User user);

    @Delete("delete from sys_user where id = #{id}")
    Integer deleteById(@Param("id") Integer id);

    @Select("SELECT * FROM `sys_user` limit #{pageNum},#{pageSize}")
    List<User> selectPage(Integer pageNum, Integer pageSize);

    @Select("select count(*) from sys_user")
    Integer selectTotal();
*/

}
